import { ImageResponse } from 'next/og'; import { getAssetBySlug } from '@/lib/queries/assets'; import { catName } from '@/lib/taxonomy'; import { ogMark } from '@/components/layout/logo'; export const runtime = 'nodejs'; export const alt = 'RareIndex asset card'; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; function money(v: number | null): string { if (v === null) return 'Data unavailable'; return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: v >= 1000 ? 0 : 2 }).format(v); } export default async function Image({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const a = await getAssetBySlug(slug); const title = a?.title ?? 'RareIndex'; const cat = a ? catName(a.categorySlug) : ''; const riv = a ? money(a.rivUsd) : ''; const chg = a?.change30d ?? null; return new ImageResponse( (